import java.util.*;
public class HelloGood {
    public static void main9(String[] args) {
        int j = 1;
        int count = 1;
        for (j = 1; j < 20; j++) {
            if (j == 5 || j == 15)
                continue;
            else {
                count = j * j;
                if (count <= 300) {
                    System.out.println(count);
                }
            }
        }
    }

    public static void main7(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int i = 0;
        int j = 0;
        for (i = 0; i < n; i++)
        {

            for (j = 0; j < n - 1 - i; j++)
            {
                System.out.print(" ");
            }
            for (j = 0; j < 2 * i + 1; j++)
            {
                System.out.print("*");
            }
            System.out.println();
        }
    }
    public static void main11(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        double j=0.0;
        if(n<10)
        {
            j=20*n;
            System.out.println(j);
        }
        else if(n<50)
        {
            j=20*0.9*n;
            System.out.println(j);
        }
        else
        {
            j=20*0.8*n-50;
            System.out.println(j);
        }
    }
    public static void main3(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n>=1&&n<=3)
        {
            System.out.println("第一季度：1-3月");
        }
        else if(n>=4&&n<=6)
        {
            System.out.println("第二季度：4-6月");
        }
        else if(n>=7&&n<=9)
        {
            System.out.println("第三季度：7-9月");
        }
        else if(n>=10&&n<=12)
        {
            System.out.println("第四季度：10-12月");
        }
    }
    public static void main12(String[] args) {
          Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if((n%4==0&&n%100!=0)||n%400==0)
        {
            System.out.print(n);
            System.out.println("是闰年");
        }
        else {
            System.out.print(n);
            System.out.println("不是闰年");
        }
    }

    public static void main6(String[] args) {
       /* Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        System.out.println(n);
        System.out.println(Integer.MAX_VALUE);
        */
        int n=20;
        do{
            if(n%3==0)
            {
                System.out.println(n);
            }
        }while(n<=50);
       /* for(n=20;n<=50;n++)
        {
            if(n%3==0)
            {
                System.out.println(n);
            }
        }

        */
       /* while(n>=20&&n<=50)
        {
            if(n%3==0)
            {
                System.out.println(n);
            }
            n++;
        }

        */




       do{
            if(n%3==0)
            {
                System.out.println(n);
            }
        }while(n<=50);



    }
}
